{include file="public/header"}
<div class="pub_wid notice_cont">
    <div class="notice_left bgb lf" id="newsDetail">
        <h1>留言<span>当前位置：<a href="/">主页</a>><a href="/index/message/index">留言</a>></span></h1>
       <div class="perfect_cont">
           <ul class="att_box widthauto">
               <li><span>您的电话：</span>
                   <input v-model="mobile" name="mobile" type="text" class="bai" placeholder="请输入您的电话">
               </li>
               <li><span>您的姓名：</span>
                   <input v-model="name" name="name" type="text" class="bai" placeholder="请输入您的姓名">
               </li>
               <li><span>留言内容：</span>
                   <textarea v-model="content" name="content" cols="" class="bai" rows="" placeholder="请输入您的留言内容"></textarea>
               </li>
           </ul>
       </div>
        <div class="submit my_message_btn"><a href="/" class="lf">返回</a><a @click='addMessage()' class="rg cur">提交</a></div>
    </div>

    {include file="public/right"}
</div>
<style>
    .my_message_btn{
        padding: 0px 255px;
    }
    .my_message_btn a {
        display: block;
        width: 150px;
        text-align: center;
        line-height: 50px;
        font-size: 18px;
        border-radius: 10px;
        background: #fff;
        color: #3267cb;
        border: #3267cb solid 1px;
    }
</style>
<script>
    var newsDetailVm = new Vue({
        el:'#newsDetail',
        data:{
            mobile:'',
            name:'',
            content:''
        },
        methods:{
            addMessage:function () {
                var el = this
                var postData = {
                    mobile:el.mobile,
                    name:el.name,
                    content:el.content
                }
                AjaxPost(postData, '/index/message/addMessage').then((response => {
                    if(response.status==1){
                        $.customToastr('success',response.message)
                        setTimeout(()=>{
                            window.history.back()
                        },1500)
                    }
                    console.log(response)
                }))
            }
        },
        mounted(){
            this.$nextTick(function () {
            })
        }
    })
</script>
